


set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

if(MSVC)	
	# https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html
	message("MSVC_VERSION : ${MSVC_VERSION}")
	if(${MSVC_VERSION} GREATER_EQUAL 1930) 
		set( MY_COMPILER_NAME "2022" )
	elseif(${MSVC_VERSION} GREATER_EQUAL 1920) 
		set( MY_COMPILER_NAME "2019" )
	elseif(${MSVC_VERSION} GREATER_EQUAL 1910)
		set( MY_COMPILER_NAME "2017" )
	elseif(${MSVC_VERSION} GREATER_EQUAL 1900)
		set( MY_COMPILER_NAME "2015" )
	elseif(${MSVC_VERSION} GREATER_EQUAL 1800)
		set( MY_COMPILER_NAME "2013" )
	elseif(${MSVC_VERSION} GREATER_EQUAL 1700)
		set( MY_COMPILER_NAME "2012" )
	elseif(${MSVC_VERSION} GREATER_EQUAL 1600)
		set( MY_COMPILER_NAME "2010" )
	endif()
endif()

if(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "[Aa][Rr][Mm]" OR ${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "[Aa][Aa][Rr][Cc][Hh]" ) #Arm
	set(MY_PLATFORM_X64_X86 "arm64")
	set(MY_ARCH_SUFFIX "_arm64")
elseif("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") 	#x86
	set(MY_PLATFORM_X64_X86 "x86")
	set(MY_ARCH_SUFFIX "")
else()										#x64
	set(MY_PLATFORM_X64_X86 "x64")
	set(MY_ARCH_SUFFIX "_x64")
endif()

# We specify path to root datakit folder
set(DTK_PROJECT_DIRECTORY "$ENV{DTK_SDK_DIR}/")

# We specify Datakit include folders 
set(DTK_INCLUDE_DIRECTORY "$ENV{DTK_SDK_DIR}/Lib_Include")

if(MSVC)
	if(${MY_PLATFORM_X64_X86} STREQUAL "x86")
		set(DTK_LIB_DIRECTORY  "${DTK_PROJECT_DIRECTORY}Libs/Win32/Net${MY_COMPILER_NAME}/")
	elseif(${MY_PLATFORM_X64_X86} STREQUAL "arm64")
		set(DTK_LIB_DIRECTORY  "${DTK_PROJECT_DIRECTORY}Libs/arm64/Net${MY_COMPILER_NAME}/")
	else()
		set(DTK_LIB_DIRECTORY  "${DTK_PROJECT_DIRECTORY}Libs/Win64/Net${MY_COMPILER_NAME}/")
	endif()
elseif(UNIX)
	set(DTK_LIB_DIRECTORY  "${DTK_PROJECT_DIRECTORY}/Libs/")
endif()

if(UNIX)
	if (EXISTS "/etc/centos-release")
		file(READ "/etc/os-release" os_release_content)
		if("${os_release_content}" MATCHES "ID=\"centos\"")
			message(STATUS "CentOS detected via os-release")
			set(CENTOS TRUE)
		endif()
	else()
		message(STATUS "Not running on CentOS Linux")
		set(CENTOS FALSE)
	endif()
endif()
